package cn.flant.db.hdle.key;

import java.util.HashSet;
import java.util.Set;

public class UnionKey {
	private Set<String> columnNames = new HashSet<String>();
	private String[] namesArray = new String[0];

	public UnionKey(String... names) {
		addColumnNames(names);
	}

	public void addColumnNames(String... names) {
		if (names == null) {
			return;
		}
		for (String name : names) {
			this.columnNames.add(name);
		}
		namesArray = null;
	}

	public String[] getColumnNames() {
		if (namesArray == null) {
			namesArray = columnNames.toArray(new String[columnNames.size()]);
		}
		return namesArray;
	}
}
